<template>
    <div class="navbar">
        <div class="inline-block">
            <img class="navbar-img" src="/logo.png" />
            <a class="navbar-title" href="/">湖南科技大学-党校</a>
        </div>
        <div class="float-right inline-block navbar-select">
            <a-dropdown class="dropdown" placement="bottomRight">
                <a-menu slot="overlay">
                    <a-menu-item @click="$router.push('/user')">
                        <a href="javascript:;">个人中心</a>
                    </a-menu-item>
                    <a-menu-item @click="logout()">
                        <a href="javascript:;">退出</a>
                    </a-menu-item>
                </a-menu>
                <a-button class="navbar-button"> <a-icon type="unordered-list" /> </a-button>
            </a-dropdown>
        </div>
    </div>
</template>

<script>
  export default {
    name: "IndexNav",
    methods: {
      logout() {
        this.$store.dispatch('LogOut').then(() => {
          location.href = "/index";
        })
      }
    }
  }
</script>

<style scoped>
.float-right {
    float: right;
}
.inline-block {
    display: inline-block;
}
.navbar {
    height: 50px;
    font-size: 18px;
    color: black;
}
.navbar .navbar-img {
    width: 50px;
    padding: 15px 15px;
}
.navbar .dropdown {

}
.navbar-select {
    height: 100%;
}
.navbar-button {
    margin: 10px 5px 10px 0;
    height: 30px;
}
</style>
